/**
 * @(#)PageInfoController.java, 2020/10/10.
 * <p/>
 * Copyright 2020 Netease, Inc. All rights reserved.
 * NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.lhh.myspringboot.controller;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.lhh.myspringboot.bean.Admin;
import com.lhh.myspringboot.service.AdminService;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**O
 * @author lvhouhou(lvhouhou @ 163.com)
 */

@RestController
public class PageInfoController {


    @Autowired
    private AdminService adminService;


    @RequestMapping(value = "/getPageInfoList", method = {RequestMethod.GET})
    public PageInfo<Admin> getPageInfoList(
            @RequestParam(required = false) String page,
            @RequestParam(required = false) String size){


        PageInfo<Admin> adminList = adminService.getAdminList(NumberUtils.toInt(page, 1),
                NumberUtils.toInt(size, 15));

        System.out.println(JSON.toJSON(adminList));
        return adminList;
    }


}
